import { initPage } from '../../utils/util.js'

initPage({
	data: {
		// 加载完成
		hasLoaded: false,
		// 是否有网络
		hasNetwork: false,
		// 是否有错误
		hasError: false,
		// 错误参数
		errorParams: {
			type: 'error',
			title: '页面不是见了',
			msg: '页面没有找到'
		},
		categories: [
			{
				id: '105885',
				title: '美食',
				icon:
					'https://file.duduapp.net/2/2018/05/02/EFk7Ksx22XJMYSseaH2rAZyjrcT46Bmc.png'
			},
			{
				id: '105888',
				title: '生活',
				icon:
					'https://file.duduapp.net/2/2018/05/02/6hskEjD6jyE34CmpszFZiDGy8yrtHfMH.png'
			},
			{
				id: '105890',
				title: '酒店',
				icon:
					'https://file.duduapp.net/2/2018/05/02/ZRFJsZ36FAmysTPf5GTNX6iHmWD2wRHe.png'
			},
			{
				id: '105887',
				title: '丽人',
				icon:
					'https://file.duduapp.net/2/2018/05/02/srSkZszn8Yi5ZwJ4xRNzJnmj3JxWRMP6.png'
			},
			{
				id: '105886',
				title: '娱乐',
				icon:
					'https://file.duduapp.net/2/2018/05/02/yyiPMMZdH8FiHGZKX5xNxTPtzD7MfNFC.png'
			},
			{
				id: '105889',
				title: '电影',
				icon:
					'https://file.duduapp.net/2/2018/05/02/ckZZdtxwh4mMcRmAyCxFexATrsw4BhXH.png'
			},
			{
				id: '105893',
				title: '周边游',
				icon:
					'https://file.duduapp.net/2/2018/05/02/5xXBm86GwfEFbfe4nNszRxDF4Ri3wFi6.png'
			},
			{
				id: '105892',
				title: '汽车',
				icon:
					'https://file.duduapp.net/2/2018/05/02/xRWQ6x2tAWjtkNW8NNfaKa3x43GssRTS.png'
			},
			{
				id: '105891',
				title: '亲子',
				icon:
					'https://file.duduapp.net/2/2018/05/02/aMFizSpQ6aaXhGCDG737Md6YDyTSd3zc.png'
			},
			{
				id: '105894',
				title: '其它',
				icon:
					'https://file.duduapp.net/2/2018/05/02/TTy8TKDM8SdmBFNn3dSJ3tSFBhpM6XyY.png'
			}
		]
	},
	onLoad() {
		this.setData({
			hasLoaded: true
		})
	},
	onShow: function() {},
	// 下拉刷新
	onPullDownRefresh() {
		if (this.data.hasError) {
			wx.reLaunch({
				url: '/pages/home/index'
			})
			return
		}
		// 导航加载
		wx.showNavigationBarLoading()
		wx.stopPullDownRefresh()
		wx.hideNavigationBarLoading()
	}
})
